using System.Collections.Generic;

namespace Magiq.Tests.TestModel
{
    public class TestDomain<T, T1Inheritor> where T : ITestClass1<T>, new()
                                            where T1Inheritor : ITestClass1Inheritor<T>, T, new()
    {
        public TestDomain()
        {
            Class1s = new List<T>();
            Class2s = new List<TestClass2>();

            for (var i = 10; i < 15; i++)
            {
                Class2s.Add(new TestClass2
                                {
                                    StringProperty = "test" + i,
                                    IntProperty = i
                                });
            }
            for (var i = 100; i < 117; i++)
            {
                Class2s.Add(new TestClass2
                                {
                                    StringProperty = "lolo",
                                    IntProperty = i
                                });
            }


            for (var i = 0; i < 7; i++)
            {
                Class1s.Add(new T
                                {
                                    StringProperty = "test" + i,
                                    IntProperty = i,
                                    Reference = Class2s[i],
                                    AnotherIntProperty = i + 2,
                                    AnotherStringProperty = "pepe" + i,
                                    NullableIntProperty = i%2 == 0 ? i : (int?) null,
                                });
            }
            for (var i = 8; i < 10; i++)
            {
                Class1s.Add(new T1Inheritor
                                {
                                    StringProperty = "test" + i,
                                    IntProperty = i,
                                    Reference = Class2s[i],
                                    AnotherIntProperty = i + 2,
                                    AnotherStringProperty = "pepe" + i,
                                    NullableIntProperty = i%2 == 0 ? i : (int?) null,
                                    InheritorProperty = "testing" + (i + 7)
                                });
            }
            for (var i = 0; i < 5; i++)
            {
                Class1s.Add(new T
                                {
                                    StringProperty = "sarasa",
                                    IntProperty = i,
                                    Reference = Class2s[i],
                                    NullableIntProperty = i%2 == 0 ? i : (int?) null,
                                    AnotherIntProperty = i + 1,
                                    AnotherStringProperty = "qwerty",
                                    SelfReference = Class1s[i]
                                });
            }
            for (var i = 8; i < 15; i++)
            {
                Class1s.Add(new T1Inheritor
                                {
                                    StringProperty = "sarasa",
                                    IntProperty = i,
                                    Reference = Class2s[i],
                                    NullableIntProperty = i%2 == 0 ? i : (int?) null,
                                    AnotherIntProperty = i + 1,
                                    AnotherStringProperty = "qwerty",
                                    InheritorProperty = "pp"
                                });
            }
            Class1s.Add(new T
                            {
                                StringProperty = "sarasa",
                                IntProperty = 5,
                                Reference = Class2s[4],
                                NullableIntProperty = 2,
                                AnotherIntProperty = 4,
                                AnotherStringProperty = "sarasala"
                            });
            Class1s.Add(new T1Inheritor
                            {
                                StringProperty = "sarasa",
                                IntProperty = 5,
                                Reference = Class2s[4],
                                NullableIntProperty = 2,
                                AnotherIntProperty = 4,
                                AnotherStringProperty = "sarasala",
                                InheritorProperty = "sarasasasa"
                            });
            Class1s.Add(new T
                            {
                                StringProperty = null,
                                IntProperty = 5,
                                Reference = null,
                                NullableIntProperty = null,
                                AnotherIntProperty = 4,
                                AnotherStringProperty = "sarasala"
                            });
            Class1s.Add(new T1Inheritor
                            {
                                StringProperty = null,
                                IntProperty = 5,
                                Reference = null,
                                NullableIntProperty = null,
                                AnotherIntProperty = 4,
                                AnotherStringProperty = "sarasala",
                                InheritorProperty = null
                            });
        }

        public List<T> Class1s { get; private set; }

        public List<TestClass2> Class2s { get; private set; }
    }
}